package com.imooc.service.impl;

import com.imooc.service.StuService;
import com.imooc.mapper.StuMapper;
import com.imooc.pojo.Stu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author wangke
 * @Description 测试查询
 * @Date 2021/7/3 21:47
 * @Version 1.0
 */


@Service
public class StuServiceImpl implements StuService {
    @Autowired
    private StuMapper stuMapper;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS) //开启事务，查询只需要事务支持
    public Stu getStuInfo(int id) {
        Stu stu = stuMapper.selectByPrimaryKey(id);
        return stu;
    }
}
